<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/pages/common/taglibs.jsp"%>
<style>
.formTable{text-align:left;}

.onError{
	padding: 0px;
}

</style>
<h1>签约接口性能测试</h1>
<script type="text/javascript" src="${ctx}/pages/templete/js/validate/auth_new.js"></script>
<form id="form" action="${ctx}/pressureTest/signApiPressureTest.do" method="POST" target="_blank" >
	<input type="hidden" name="VerficationCode" value="${config.verficationCode }"/>
	<table width="100%" class="formTable">
		<tr>
			<td align=right>签约内容:</td>
			<td>
				<input type="text" id="signContext" name="signContext"/>
			</td>
			<td width="25%" align=left>
				<font color=red>*</font>
				<span id="tranCodeTip"></span>
			</td>
		</tr>
		<tr>
			<td align=right>签约所用私钥值:</td>
			<td>
				<textarea rows="5" cols="20" id="privateKey" name="privateKey"></textarea>
			</td>
			<td width="25%" align=left>
				<font color=red>*</font>
				<span id="tranCodeTip"></span>
			</td>
		</tr>
		<tr>
			<td align=right>测试时间:</td>
			<td>
				<input type="text" id="limitMills" name="limitMills" size="50" onblur="checkMillsValue()"/>秒
			</td>
			<td  width="25%"  align=left>
				<font color=red>*</font>
				<span id="merchantIDTip"></span>
			</td>
		</tr>
		
		<tr>
			<td align=right>线程数:</td>
			<td>
				<input type="text" id="concurrentNum" name="concurrentNum" onblur ="checkNumVal()"/>个线程
			</td>
			<td width="30%" align=left>
				<font color=red>*</font>
				<span id="merOrderNumTip"></span>
			</td>
		</tr>
		<tr>
			<td colspan=3 width="100%">
				<center>
					<input type="submit" name="submit" id="submit" value="开始测试" onsubmit="checkAllValue()"/>
				</center>
			</td>
		</tr>
	</table>
</form>

    <script type="text/javascript">  
         function checkMillsValue(){  
          	var obj = document.getElementById("limitMills");
          	if("" == obj.value || 0==obj.value){
         		alert("测试时间不能为空！");
         		obj.focus();
         		obj.value="";
         		return false;
         	}
          	if(!/^\+?[1-9][0-9]*$/.test(obj.value)){  
            	alert("测试时间为整数!");
            	obj.focus();
            	obj.value="";
            	return false;
        	}  
      	}
        function checkNumVal(){
    		var obj = document.getElementById("concurrentNum");
    		if("" == obj.value || 0==obj.value){
         		alert("线程数不能为空！");
         		obj.focus();
         		obj.value="";
         		return false;
         	}
    		if(!/^\+?[1-9][0-9]*$/.test(obj.value)){  
            	alert("线程数为整数!");
            	obj.focus();
            	obj.value="";
            	return false;
        	}  
    		if (obj.value>50){
    			alert("线程数最多只有50个！");
    			obj.focus();
    			obj.value="";
    			return false;
    		}
    	}
        
        function checkAllValue(){
        	var limitObj = document.getElementById("limitMills");
        	var conObj = document.getElementById("concurrentNum");
        	alert(limitObj.value);
        	alert(conObj.value);
        	if(limitObj.value=""){
        		alert("测试时间不能为空!");
        		limitOjb.focus();
        		return false;
        	}
        	if(limitObj.value==0 || limitObj.value=="0"){
        		alert("测试时间最小为一毫秒！");
        		limitOjb.focus();
        		return false;
        	}
        	if(conObj.value=""){
        		alert("线程数不能为空！");
        		conObj.focus();
        		return false;
        	}
        	if(conObj.value==0||conObj.value == "0"){
        		conObj.focus();
        		return false;
        	}
        }
    </script>  